package reflect;

import com.sun.org.apache.xalan.internal.lib.ExsltStrings;

import java.lang.reflect.Method;

public class ReflectDemo5
{
    public static void main(String[] args) throws Exception
    {
        Class aClass = Class.forName("reflect.Person");
        Object o = aClass.newInstance();
        Method say = aClass.getMethod("say", String.class);
        Method setName = aClass.getMethod("setName", String.class);
        setName.invoke(o,"蔡徐坤");
        say.invoke(o,"及你太美");
        say.invoke(o,"baby");
        Method getContent = aClass.getMethod("getContent");
        Object content = getContent.invoke(o);
        System.out.println(content.toString());
    }
}
